<template>
	<view class="content-box">
		<uni-list>
		    <uni-list-item v-for="(item,index) in fileList" :title="item.fileName" :note="'格式：'+item.filePostfix" :key="index" @click="open(item)"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
	import {getProblemContent} from '@/api/user/index.js'
	export default {
		 
		data() {
			return {
			contentlist:[],
			contentid:'',
			fileList:[],
			pdfUrl:""
			}
		},
		components: {uniListItem},
		methods: {
			gohome(){
				uni.redirectTo({
					url:'/pages/index/proposal/titlelist'
				});
			},
			getFileName:function(url){
				let arr = url.split('/');
				return arr[arr.length -1].split('.')
			},
			open:function(item){
				uni.navigateTo({
					url: '/pages/index/proposal/info?item=' + encodeURIComponent(JSON.stringify(item))
				})
				// window.location.href = item.file;
			}
		},
		onLoad(op) {
			this.contentid = op.id
			var that = this;
			getProblemContent(this.contentid).then((res) =>{
				res.result.file.map(function(item,index){
					item.fileName = that.getFileName(item.file)[0];
					item.filePostfix = that.getFileName(item.file)[1];
				})
				that.fileList = res.result.file
				console.log(that.fileList)
			})
		}
	}
</script>

<style lang="scss" scoped>
	
	.container {
		width: 100%;
		height: calc( 100vh);
		
		.content-header{
			width: 100%;
			height: 100rpx;
			background-color: #ffffff;
			border-bottom: 2rpx solid #efeff4;
			position: fixed;
			.header-title{
				width: 100%;
				height: 100rpx;
				color: #000000;
				line-height: 100rpx;
				text-align: center;
			}
			
			.header{
				text-align: center;
				height: 100rpx;
				position: absolute;
				z-index: 2;
				top: 0rpx;
				.herderimg{
					width: 35rpx;
					height: 100rpx;
				}
				.header-text{
					width: 60rpx;
					height: 90rpx;
					color: #000000;
					line-height: 90rpx;
				}
			}
		}
		
		.content-title{
			width: 100%;
			height: 185rpx;
			.title-texttime{
				background-color: #FFFFFF;
				text-indent: 20rpx;
				height: 40rpx;
			}
		}
		.content-text{
			width: 95%;
			padding-top: 10rpx;
			.title-contenttext{
				text-indent: 30rpx;
			}
		}
	}
</style>
